package com.example.yls.broadcastreceiver_b;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {
 private Button btnb1;
 private Button btnb2;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        btnb1 = findViewById(R.id.btnb_1);
        btnb2 = findViewById(R.id.btnb_2);
        btnb1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent1 = new Intent();
                intent1.setAction("weather_info");
                intent1.putExtra("weather","晴天");
                intent1.putExtra("warn",27);
                sendBroadcast(intent1);
            }
        });
    }
}
